public class BooksTestDrive {
    public static void main(String[] args) {
        Books[] myBooks = new Books[3];
        int x = 0;
        myBooks[0] = new Books();
        myBooks[1] = new Books();
        myBooks[2] = new Books();

        myBooks[0].title = "The Old Man and the Sea";
        myBooks[1].title = "David Copperfield";
        myBooks[2].title = "Robinson Crusoe";

        myBooks[0].author = "Hemingway";
        myBooks[1].author = "Dickens";
        myBooks[2].author = "Defoe";

        while(x<3){
            System.out.print(myBooks[x].title);
            System.out.print(" by ");
            System.out.print(myBooks[x].author+" ");
            x = x+1;
        }
    }
}
